//
//  ForgotPasswordViewController.m
//  XingMei
//
//  Created by 钱金军 on 2019/3/21.
//  Copyright © 2019年 钱金军. All rights reserved.
//

#import "ForgotPasswordViewController.h"
#import "FilesHeader.h"

@interface ForgotPasswordViewController ()

@property (nonatomic,strong) YanZhengMaBtn *yanZheng;

@end

@implementation ForgotPasswordViewController
{
    UITextField *phoneText, *validationCodeText;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self setNavBackgroundImageTitleText:@"忘记密码"];
    [self setContentView];
}

- (void)setContentView{
    NSArray *imgArr = [NSArray arrayWithObjects:@"register_icon_6",@"register_icon_2", nil];
    NSArray *titleArr = [NSArray arrayWithObjects:@"手机号",@"验证码", nil];
    
    for (int i = 0; i < imgArr.count; i++) {
        UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(50, Height_NavBar + 70 + i*35, 15, 15)];
        imgView.image = [UIImage imageNamed:imgArr[i]];
        [self.view addSubview:imgView];
        
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(imgView.right + 7, imgView.top, 50, 15)];
        label.text = titleArr[i];
        label.textColor = rgba(51, 51, 51, 1);
        label.textAlignment = NSTextAlignmentCenter;
        label.font = [UIFont fontWithName:ZhongDeng size:14];
        [self.view addSubview:label];
        
        UITextField *text = [[UITextField alloc] initWithFrame:CGRectMake(label.right + 10, label.top, KScreenWidth-label.right-70, label.frame.size.height)];
        text.layer.borderColor = [UIColor clearColor].CGColor;
        text.font = [UIFont fontWithName:ZhongDeng size:14];
        [self.view addSubview:text];
        
        UIView *line = [[UIView alloc] initWithFrame:CGRectMake(label.right, text.bottom + 10, KScreenWidth-label.right-50, 1)];
        line.backgroundColor = rgba(232, 232, 232, 1);
        [self.view addSubview:line];
        
        if (i == 0) {
            phoneText = text;
        }else if (i == 1){
            validationCodeText = text;
        }
        
        if (i == 1) {
            text.frame = CGRectMake(label.right + 10, label.top, KScreenWidth-label.right-70, label.frame.size.height);
            //手机验证码
            self.yanZheng = [YanZhengMaBtn buttonWithType:UIButtonTypeCustom];
            self.yanZheng.frame = CGRectMake(3, 2, 40, text.frame.size.height);
            [self.yanZheng setTitle:@"获取" forState: UIControlStateNormal ];
            [self.yanZheng setTitleColor:rgba(255, 138, 10, 1) forState:UIControlStateNormal];
            self.yanZheng.titleLabel.font=[UIFont systemFontOfSize:14];
            self.yanZheng.backgroundColor = [UIColor whiteColor];
            self.yanZheng.DaoJiShitime=60;
            self.yanZheng.enabled=YES;
            self.yanZheng.againColor=[UIColor clearColor];
            [self.yanZheng addTarget:self action:@selector(sendCord) forControlEvents:UIControlEventTouchUpInside];
            self.yanZheng.layer.borderColor = rgba(255, 138, 10, 1).CGColor;
            self.yanZheng.layer.borderWidth = 1;
            
            text.rightViewMode = UITextFieldViewModeAlways;
            text.rightView = self.yanZheng;
            
            /** 下一步 */
            UIButton *nextStepBtn = [[UIButton alloc] initWithFrame:CGRectMake(48, line.bottom + 40, KScreenWidth-96, 45)];
            [nextStepBtn setBackgroundImage:[UIImage imageNamed:@"register_img_10"] forState:UIControlStateNormal];
            [nextStepBtn setTitle:@"下一步" forState:UIControlStateNormal];
            [nextStepBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            nextStepBtn.layer.cornerRadius = 22;
            [self.view addSubview:nextStepBtn];
            [nextStepBtn addTarget:self action:@selector(clickNextStep) forControlEvents:UIControlEventTouchUpInside];
        }
        
    }
    
    
}

#pragma mark 获取验证码
- (void)sendCord{
    
}

#pragma mark 点击下一步
- (void)clickNextStep{
    EditPasswordViewController *editPassword = [[EditPasswordViewController alloc] init];
    editPassword.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    [self presentViewController:editPassword animated:YES completion:nil];
}



@end
